﻿<Window x:Class="Demos.Puzzles.Nqueens.View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Nqueens="clr-namespace:Demos.Puzzles.Nqueens" Title="N-Queens" Height="400" Width="600">
    <Grid Margin="10" Name="mainGd">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"></RowDefinition>
            <RowDefinition Height="35"></RowDefinition>
            <RowDefinition Height="35"></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        
        <Label Grid.Row="0" Grid.Column="1" Margin="5" HorizontalAlignment="Right">Reinas:</Label>
        <TextBox Grid.Row="0" Grid.Column="2" Width="30" IsReadOnly="True" Margin="5" TextAlignment="Center" 
                 HorizontalAlignment="Left"
                 Text="{Binding ElementName=NumeroReinasSld, Path=Value}">
        </TextBox>
        <Slider Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Minimum="2" Maximum="20" 
                IsSnapToTickEnabled="True" Margin="5" Name="NumeroReinasSld"
                Value="{Binding NumeroReinas, UpdateSourceTrigger=PropertyChanged}">
        </Slider>
        <ComboBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Name="algoritmoCb"
                  SelectedIndex="{Binding AlgoritmoSeleccionado, UpdateSourceTrigger=PropertyChanged}">
            <ComboBoxItem>Backtracking1</ComboBoxItem>
            <ComboBoxItem>Backtracking2</ComboBoxItem>
            <ComboBoxItem>Backtracking3</ComboBoxItem>
            <ComboBoxItem>Backtracking4</ComboBoxItem>
            <ComboBoxItem>Backtracking5</ComboBoxItem>
            <ComboBoxItem>DLX2</ComboBoxItem>
        </ComboBox>
        <Button Grid.Row="2" Grid.Column="2" Margin="5"
                Command="{Binding PosicionarCommand}">Posicionar
        </Button>
        
        <Label Grid.Row="3" Grid.Column="1" VerticalAlignment="Center">Animación:</Label>
        <Slider Grid.Row="3" Grid.Column="2" Minimum="1" Maximum="2000" VerticalAlignment="Center" 
                Value="{Binding DuracionAnimacion, UpdateSourceTrigger=PropertyChanged}"></Slider>
        
        <GroupBox Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" Header="Tiempos">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Label Grid.Row="0" Grid.Column="0">Backtracking1:</Label>
                <Label Grid.Row="1" Grid.Column="0">Backtracking2:</Label>
                <Label Grid.Row="2" Grid.Column="0">Backtracking3:</Label>
                <Label Grid.Row="3" Grid.Column="0">Backtracking4:</Label>
                <Label Grid.Row="4" Grid.Column="0">Backtracking5:</Label>
                <Label Grid.Row="5" Grid.Column="0">DLX2: </Label>
                <TextBox Grid.Row="0" Grid.Column="1" IsEnabled="False" Margin="2" Text="{Binding Tiempos[0], UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <TextBox Grid.Row="1" Grid.Column="1" IsEnabled="False" Margin="2" Text="{Binding Tiempos[1], UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <TextBox Grid.Row="2" Grid.Column="1" IsEnabled="False" Margin="2" Text="{Binding Tiempos[2], UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <TextBox Grid.Row="3" Grid.Column="1" IsEnabled="False" Margin="2" Text="{Binding Tiempos[3], UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <TextBox Grid.Row="4" Grid.Column="1" IsEnabled="False" Margin="2" Text="{Binding Tiempos[4], UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <TextBox Grid.Row="5" Grid.Column="1" IsEnabled="False" Margin="2" Text="{Binding Tiempos[5], UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <Button Grid.Row="6" Grid.Column="1" Margin="2" Command="{Binding MedirCommand}">Medir</Button>
            </Grid>
        </GroupBox>

        <Border Grid.Row="0" Grid.Column="3" Grid.RowSpan="5" BorderBrush="DarkGray" BorderThickness="1" Margin="10,0,0,0" Name="TableroBr" Height="{Binding ElementName=mainGd, Path=ActualHeight}" Width="{Binding ElementName=TableroBr, Path=ActualHeight}">
            <ItemsControl ItemsSource="{Binding Tablero, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <UniformGrid></UniformGrid>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid Background="{Binding Fondo}">
                            <Image Source="media\reina.png" Visibility="{Binding Reina}" 
                                   Name="reina"
                                   Height="{Binding ElementName=reina, Path=Width}">
                             </Image>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Border>
    </Grid>
</Window>
